<?php
class core {
	

	public function __construct(){
		global $M,$C,$A; 
		$arr = explode('/',$_SERVER["PATH_INFO"]);

		list(,$M,$C,$A) = $arr;

		$cname = $C."Controller";
		$obj = new $cname();

		$request = new Request();

		$obj->$A($request);
	}

}
function __autoload($classname) {
	global $M;
	if(strpos($classname, "Model")!==false){
		if(strpos($classname,"Base")!==false){
			$classpath =  "./Library/".$classname.".php";
		}else{

			$classpath =  "./".$M."/Model/".$classname.".php";
		}
	}elseif(strpos($classname,"Controller")!==false){
		if(strpos($classname,"Base")!==false){
			$classpath =  "./Library/".$classname.".php";
		}else{
			$classpath =  "./".$M."/Controller/".$classname.".php";
		}
	}else{
		$classpath =   "./Library/".$classname.".class.php";
	}
	if(file_exists($classpath)==false){
		die("'".$classname." 'file not exists !!!!");
	}
	include_once $classpath;
}